
using Crux.Core.EasyNetQ;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;

namespace System;
/// <summary>
/// EasyNetQServiceCollectionExtensions
/// </summary>
public static class EasyNetQServiceCollectionExtensions
{
    /// <summary>
    ///
    /// </summary>
    /// <param name="services"></param>
    public static void AddEasyNetQ(
        this IServiceCollection services)
    {
        services.TryAddSingleton<IAutoSubscriberMessageDispatcher, ServiceProviderSubscriberMessageDispatcher>();
        services.TryAddSingleton<IRabbitMqBusAccessor, RabbitMqBusAccessor>();
        services.TryAddSingleton<EasyNetQInitializer>();
        services.TryAddScoped<IEasyNetQFacade, EasyNetQFacade>();
    }

}